Llamando librerías

library(ggplot2)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout

Leemos datos y agregamos Interpretación de Estatus

base<-read.csv("../data/UIID_statusdx.csv",header=T)
class(base)
## [1] "data.frame"
base<-base%>%
  as_data_frame()%>%
  mutate(EstatusDx=as.character(ESTATUDX),
         EstatusDx=if_else(ESTATUDX==0,"C. Sin IDP",EstatusDx),
         EstatusDx=if_else(ESTATUDX==1,"B. Con IDP",EstatusDx),
         EstatusDx=if_else(ESTATUDX==2,"A. IDP en estudio",EstatusDx))
class(base)
## [1] "tbl_df"     "tbl"        "data.frame"
base
gg01<-ggplot(data=base,aes(x=aniocons, group=EstatusDx, fill=EstatusDx)) + 
    geom_density(adjust=1.5, position="fill")
# gg01
gg01_pl<-ggplotly(gg01)
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`
gg01_pl